package transaction.imp;

import classification.PaymentClassification;
import dao.PayrollDatabase;
import dao.imp.GpayrollDatabase;
import domain.Employee;
import method.imp.HoldMethod;
import schedule.PaymentSchedule;
import transaction.Transaction;

public abstract class AddEmployeeTransaction implements Transaction {
    private int empId;
    private String name;
    private String address;
    private PayrollDatabase payrollDatabase = new GpayrollDatabase();

    public AddEmployeeTransaction() {
    }

    public AddEmployeeTransaction(int empId, String name, String address) {
        this.empId = empId;
        this.name = name;
        this.address = address;
    }

    public abstract PaymentClassification getPaymentClassification();
    public abstract PaymentSchedule getPaymentSchedule();

    @Override
    public void execute() {
        Employee employee = new Employee(empId, name, address);
        HoldMethod holdMethod = new HoldMethod();
        employee.setClassification(getPaymentClassification());
        employee.setSchedule(getPaymentSchedule());
        employee.setMethod(holdMethod);
        payrollDatabase.addEmployee(employee);
    }

    public int getEmpId() {
        return empId;
    }

    public void setEmpId(int empId) {
        this.empId = empId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
